import request from "@/axios/request";
import url from "@/axios/url";
const { mesUrl, adminUrl } = url();
// 导出url
export const exportUrl = `${mesUrl}mesProdOrder/export`;
// 获取详情
export function getInfo (id = "") {
  return request({
    url: `${mesUrl}mesProdOrder/info/${id}`,
    method: "get",
  });
}
//分页查询
export function getList (params = {}) {
  return request({
    url: `${mesUrl}mesProdOrder/selectList`,
    method: "get",
    params,
  });
}
// 查询线体编码列表
export function getLineCodeList (params) {
  return request({
    url: `${adminUrl}baseFactoryModeling/children`,
    method: "get",
    params,
  });
}

// 是否正在执行接口(0:否,1:是)
export function getIsRunningList () {
  return request({
    url: `${adminUrl}dict/type/yes_or_not`,
    method: "get",
  });
}
// 查询订单状态（未开始，进行中，已完成，待下发，已下发）列表
export function getProdOrderStatusList () {
  return request({
    url: `${adminUrl}dict/type/prod_order_status`,
    method: "get",
  });
}
// 查询前置工单类型列表
export function getPrepositionTypeList () {
  return request({
    url: `${adminUrl}dict/type/order_preposition_type`,
    method: "get",
  });
}
// 查询生产订单类型：内销，外销，样机列表
export function getProdOrderTypeList () {
  return request({
    url: `${adminUrl}dict/type/prod_order_type`,
    method: "get",
  });
}
// 查询  0：自动倒冲，1：手动倒冲列表
export function getBackflushTypeList () {
  return request({
    url: `${adminUrl}dict/type/backflush_type`,
    method: "get",
  });
}
// 查询虚实订单类型（无bom虚单，实单，bom需单）列表
export function getSimulatedTypeList () {
  return request({
    url: `${adminUrl}dict/type/simulated_type`,
    method: "get",
  });
}
//------------------------------------------------
/* 条码打印模板下拉列表 */
export function barcodePrintingList2 (data = "") {
  return request({
    url: `${adminUrl}printTemplate/list`,
    headers: {
      "Content-Type": "application/x-www-form-urlencoded",
    },
    method: "post",
    data: data,
  });
}
/* 打印模板详情 */
export function printTemplateInfo (id = "") {
  return request({
    url: `${adminUrl}printTemplate/info/${id}`,
    method: "get",
  });
}

/* 条码打印详情 */
export function barcodePrintingDetail (params) {
  return request({
    url: `${wmsserviceUrl}wmsInventorySn/info`,
    method: "get",
    params,
  });
}
/* 条码打印新增 */
export function barcodePrintingAdd (data = "") {
  return request({
    url: `${wmsserviceUrl}wmsReprintCode/addReprintCode`,
    method: "post",
    params: data,
  });
}
/* 条码打印新增 */
export function barcodePrintingAdd2 (data = "") {
  return request({
    url: `${wmsserviceUrl}wmsReprintCode/addSplitCode`,
    method: "post",
    params: data,
  });
}

/* 箱码列表 */
export function mesProdBoxcode (data = {}) {
  return request({
    url: `${mesUrl}mesProdBoxcode/list`,
    method: "get",
    params: data,
  });
}
/* 箱码列表 */
export function baseCodeStrategy (data = {}) {
  return request({
    url: `${adminUrl}baseCodeStrategy/list`,
    method: "get",
    params: data,
  });
}

/* 打印箱码 */
export function printBoxcode (data = "") {
  return request({
    url: `${mesUrl}mesProdBoxcode/printBoxcode`,
    method: "post",
    data,
  });
}

export function reprintSel (data = "") {
  return request({
    url: `${mesUrl}mesProdBoxcode/reprintSel`,
    method: "post",
    data,
  });
}
/* 补打查询--箱码列表 */
export function reprintSelList (data = "") {
  return request({
    url: `${mesUrl}mesProdBoxcode/reprintSelList`,
    method: "post",
    data,
  });
}
/* 箱码打印-获取条码数量，已打印、未打印数量 */
// export function getBoxCount(data = "") {
//   return request({
//     url: `${mesUrl}mesProdBoxcode/getBoxCount`,
//     method: "post",
//     data,
//   });
// }

// 根据工单编码获取跟踪卡打印信息
export function getBoxCount (data = "") {
  return request({
    url: `${mesUrl}mesProdBarcode/getTrackingMsg`,
    method: "post",
    data,
  });
}

// 生成生产跟踪卡
export function creatBoxCode (data = "") {
  return request({
    url: `${mesUrl}mesProdBarcode`,
    method: "post",
    data,
  });
}

// 打印生产跟踪卡
export function printBarcode (data = "") {
  return request({
    url: `${mesUrl}mesProdBarcode/printBarcode`,
    method: "post",
    data,
  });
}

// 清除生产跟踪卡
export function clearBoxcode (data = "") {
  return request({
    url: `${mesUrl}mesProdBarcode/clearBarcode`,
    method: "post",
    data,
  });
}
// 获取下一工序
export function getNextProcess (data = "") {
  return request({
    url: `${mesUrl}mesMaterialPrintHistory/getNextProcessNew`,
    method: "post",
    data,
  });
}
// 根据条码扫描明细表id获取相应总数量、已打印数量、未打印数量
export function getQuantityById (data = "") {
  return request({
    url: `${mesUrl}mesMaterialPrintHistory/getQuantityById`,
    method: "post",
    data,
  });
}
// 打印物料流转卡
export function printMaterial (data = "") {
  return request({
    url: `${mesUrl}mesMaterialPrintHistory/printMaterial`,
    method: "post",
    data: {
      ...data,
      printTemp: data.barcodePrintTemp,
    },
  });
}
// 获取工序列表
export function getProcessList (data = "") {
  return request({
    url: `${mesUrl}mesMaterialPrintHistory/getProcessList`,
    method: "post",
    data,
  });
}

// 获取工序列表
export function getProcessListByTechnologyId (data = "") {
  return request({
    url: `${mesUrl}mesMaterialPrintHistory/getProcessListByTechnologyId`,
    method: "get",
    params: data,
  });
}
